import React, { PureComponent } from 'react';
import Home from './Home';
import Recommend from './Recommend';
import Profile from './Profile';
class App extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      counter: 0,
      message: 'Hello React'
    }
  }

  increment() {
    this.setState({
      counter: this.state.counter + 1
    })
  }

  changeText() {
    this.setState({
      message: '你好啊, 李银河'
    })
  }

  render() {
    console.log("App");
    const {counter, message} = this.state

    return (
      <div>
        <h2>App: {message} - {counter}</h2>
        <button onClick={() => this.increment()}>+1</button>
        <button onClick={() => this.changeText()}>修改文本</button>
        <Home message={message}></Home>
        <Recommend counter={counter}></Recommend>
        <Profile message={message}></Profile>
      </div>
     );
  }
}
 
export default App;